<?php
	echo '<h1>User Management</h1>';
	echo '<br>';
	echo '<p>';
		echo '<a href="'.base_url().'index.php/admin/dashboard/createuser"><input type="button" class="btn" value="Create New User" /></a>';
	echo '</p><br>';
	
	$users = $this->MUser->getAllUsers();
	
	if ( count($users) )
	{
		echo "<table id='rounded-corner' class='tablesorter' border='1' cellspacing='0' cellpadding='3' width='100%'>\n";
		echo "<thead>\n<tr valign='top'>\n";
		echo "<th>No</th>\n<th>Username</th><th>Email</th><th>Role</th><th>Activate</th><th>Actions</th>\n";
		echo "</tr>\n</thead>\n<tbody>\n";
		$i = 1;
		foreach ($users as $key => $list){
			echo "<tr valign='top'>\n";
			echo "<td align='center'>".$i++."</td>\n";
			echo "<td align='center'>".$list['username']."</td>\n";
			echo "<td align='center'>".$list['email']."</td>\n";
			echo "<td align='center'>".$list['title']."</td>\n";
			if($list['activate']==1) 
				$activate = 'active';
			else 
				$activate = 'inactive';
				
			echo "<td align='center'>". $activate."</td>\n";
			echo "<td align='center'>";
			echo anchor('admin/dashboard/edituser/'.$list['uid'],'edit');
			echo " | ";
			echo anchor('admin/dashboard/deleteuser/'.$list['uid'],'delete',array('class'=>'delete-item'));
			echo "</td>\n";
			echo "</tr>\n";
		}
		echo "</tbody>\n</table>";
	}
?>